import 'package:json_annotation/json_annotation.dart';

import 'login_type.dart';
import 'login_type_converter.dart';

part 'login_request.g.dart';

@JsonSerializable(
  explicitToJson: true,
  anyMap: true,
  converters: [LoginTypeConverter()],
)
class LoginRequest {
  final LoginType loginType;
  final String username;
  final String password;
  final String phone;
  final String verificationCode;
  final String openId;

  LoginRequest(
    this.loginType,
    this.username,
    this.password,
    this.phone,
    this.verificationCode,
    this.openId,
  );

  factory LoginRequest.fromJson(Map<String, dynamic> json) =>
      _$LoginRequestFromJson(json);

  Map<String, dynamic> toJson() => _$LoginRequestToJson(this);
}
